#!/bin/bash

disk=$1

function get_diskio()
{
	disk=$1
	echo $(cat /proc/diskstats | awk '$3 == "'"${disk}"'" { print $10 }')
}

old=$(get_diskio ${disk})
while true
do
	now=$(get_diskio ${disk})

        delta=$(echo "$now - $old" | bc)

        usage=$(echo "scale=2; $delta * 100 / 1000" | bc)
        echo "disk usage: ${usage}%"
        old=$now

        sleep 1
done

